﻿@model List<SalesReportViewModel>
@{
    ViewBag.Title = "Year Sales";
    Double totalSales = 0;
    Double totalProfit = 0;
    Double productProfit = 0;
}

 @foreach (var item in Model)
    {
    <ul data-role="listview" data-inset="true">
        <li data-role="list-divider">@item.productName</li>
        @{
        productProfit = item.sellingPrice - item.purchasePrice;
        totalSales = totalSales + item.sellingPrice;
        totalProfit += (item.sellingPrice - item.purchasePrice);
      }
        <li>
            Selling Price:R @Html.DisplayFor(modelItem => item.sellingPrice)
        </li>
        
        <li>
            Sold Date: @Html.DisplayFor(modelItem => item.soldDate)

        </li>
        <li>
            Product Profit: @Html.DisplayFor(modelItem => productProfit)
        </li>
        
    </ul>
    }
    
 <ul data-role="listview" data-inset="true">
        <li data-role="list-divider">Summary</li>
       
        <li>
             Total Sales: @totalSales
        </li>
        <li>
             Total Profit: @totalProfit
        </li>

</ul>